Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@node-saml/node-saml

Package Overview
Dependencies
Maintainers
2
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@node-saml/node-saml

SAML 2.0 implementation for Node.js

  • 4.0.5
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
188K
decreased by-13.26%
Maintainers
2
Weekly downloads
 
Created

What is @node-saml/node-saml?

@node-saml/node-saml is an npm package that provides tools for implementing SAML (Security Assertion Markup Language) authentication in Node.js applications. It allows developers to handle SAML authentication flows, including generating SAML requests, parsing SAML responses, and validating SAML assertions.

What are @node-saml/node-saml's main functionalities?

Generate SAML Request

This feature allows you to generate a SAML authentication request that can be sent to an Identity Provider (IdP). The code sample demonstrates how to create a SAML request using the SAML class and its generateRequest method.

const { SAML } = require('@node-saml/node-saml');
const saml = new SAML({
  entryPoint: 'https://idp.example.com/sso',
  issuer: 'https://sp.example.com/metadata'
});

saml.generateRequest({
  callbackUrl: 'https://sp.example.com/acs'
}, (err, request) => {
  if (err) {
    console.error(err);
  } else {
    console.log('SAML Request:', request);
  }
});

Parse SAML Response

This feature allows you to parse and validate a SAML response received from an Identity Provider (IdP). The code sample demonstrates how to use the validateResponse method to extract user profile information from the SAML response.

const { SAML } = require('@node-saml/node-saml');
const saml = new SAML({
  cert: 'MIIC...AB', // IdP public certificate
  issuer: 'https://sp.example.com/metadata'
});

const samlResponse = '...'; // SAML response from IdP
saml.validateResponse(samlResponse, (err, profile) => {
  if (err) {
    console.error(err);
  } else {
    console.log('User Profile:', profile);
  }
});

Generate SAML Metadata

This feature allows you to generate SAML metadata for your Service Provider (SP). The code sample demonstrates how to use the generateServiceProviderMetadata method to create the metadata XML that can be shared with Identity Providers (IdPs).

const { SAML } = require('@node-saml/node-saml');
const saml = new SAML({
  callbackUrl: 'https://sp.example.com/acs',
  issuer: 'https://sp.example.com/metadata',
  cert: 'MIIC...AB', // SP public certificate
  privateKey: 'MIIE...AQAB' // SP private key
});

const metadata = saml.generateServiceProviderMetadata();
console.log('SP Metadata:', metadata);

Other packages similar to @node-saml/node-saml

Keywords

FAQs

Package last updated on 19 Aug 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc